package com.yunxi.controller.sto;

import com.yunxi.sto.pojo.PartnerVehicleTradeDetailVO;
import com.yunxi.sto.service.PartnerVehicleTradeDetailDubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.core.web.ApiResult;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 渠道商车辆买卖详情 前端控制器
 * </p>
 *
 * @author caoYong
 * @since 2019-08-30
 */
@RestController
@RequestMapping("/admin/partnerVehicleTradeDetail")
@Api(tags = "sto:partnerVehicleTradeDetail", description = "渠道商车辆买卖详情接口")
public class PartnerVehicleTradeDetailController {
    private static final Logger logger = LoggerFactory.getLogger(PartnerVehicleTradeDetailController.class);

    @Autowired
    PartnerVehicleTradeDetailDubboService partnerVehicleTradeDetailDubboService;

    @GetMapping("/page")
    @ApiOperation(value = "查询渠道商车辆买卖详情分页")
    public ApiResult page(PartnerVehicleTradeDetailVO partnerVehicleTradeDetailVO, Integer pageNum, Integer pageSize) throws Exception {
        return ResponseUtil.ok(partnerVehicleTradeDetailDubboService.findPageByVO(partnerVehicleTradeDetailVO, pageNum, pageSize));
    }

    /*@GetMapping("/list")
    @ApiOperation(value = "查询渠道商车辆买卖详情列表")
    public ApiResult list(PartnerVehicleTradeDetailVO partnerVehicleTradeDetailVO) throws Exception {
        return ResponseUtil.ok(partnerVehicleTradeDetailDubboService.listByVo(partnerVehicleTradeDetailVO));
    }

    @GetMapping("/load")
    @ApiOperation(value = "读取单个渠道商车辆买卖详情")
    public ApiResult load(PartnerVehicleTradeDetailVO partnerVehicleTradeDetailVO, @CurrentUser LoginInfo loginInfo) throws Exception {
        return ResponseUtil.ok(partnerVehicleTradeDetailDubboService.getById(partnerVehicleTradeDetailVO.getTradeDetailId()));
    }

    @PostMapping("/save")
    @ApiOperation(value = "保存渠道商车辆买卖详情信息")
    public ApiResult save(@RequestBody PartnerVehicleTradeDetailVO partnerVehicleTradeDetailVO, @CurrentUser LoginInfo loginInfo) throws Exception {
        partnerVehicleTradeDetailDubboService.saveOrUpdate(partnerVehicleTradeDetailVO);
        return ResponseUtil.ok("success");
    }

    @PostMapping("/del")
    @ApiOperation(value = "删除渠道商车辆买卖详情")
    public ApiResult del(@RequestBody List<PartnerVehicleTradeDetailVO> partnerVehicleTradeDetailVOList) throws Exception {
        partnerVehicleTradeDetailDubboService.removeByListVo(partnerVehicleTradeDetailVOList);
        return ResponseUtil.ok("success");
    }*/

}
